package com.zxlspace.java8;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Month;

/**
 * @ClassName Java8TimeTest
 * @Description TODO
 * @Author zhangxiaolin@pinpianyi.com
 * @Date 2019/4/11 18:06
 * @Version 1.0
 **/
public class Java8TimeTest {

    public static void main(String[] args) {
        Java8TimeTest timeTest = new Java8TimeTest();
        timeTest.testLocalDateTime();
    }

    public void testLocalDateTime() {
        //获取当前时间
        LocalDateTime currentTime = LocalDateTime.now();
        System.out.println("当前时间：" + currentTime);

        LocalDate localDate = currentTime.toLocalDate();
        System.out.println("date1:" + localDate);

        Month month = currentTime.getMonth();
        int day = currentTime.getDayOfMonth();
        int seconds = currentTime.getSecond();
        System.out.println("月：" + month + "日：" + day + "秒：" + seconds);
    }
}
